<template>
    <div class="container text-center">
         
         <div class="btn-area">
             <mt-button type="default" class="btn-block" @click="cancelLogin">取消登录</mt-button>
        <mt-button type="primary" class="btn-block" @click="doLogin">确认登录</mt-button>
             </div>
        

    </div>
</template>
<script>
export default {
  created() {},
  methods: {
    cancelLogin() {
      WeixinJSBridge.call("closeWindow");
    },
    doLogin() {
      let token = this.$route.query.token;
      if (token) {
        this.showLoading();
        this.$post("/api/check_login", { token }).then(_ => {
          this.hideLoading();
          this.$toast("扫码成功!");
          WeixinJSBridge.call("closeWindow");
        }).catch(_=>{
            this.hideLoading();
        });
      }
    }
  }
};
</script>
<style lang="scss" scoped>
.btn-area {
  padding: 2rem;
}
.btn-block {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
}
</style>
